package com.mlz.mlzmall.ui.dialog;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.PopupWindow;
import android.widget.TextView;

import com.mlz.mlzmall.R;

/**
 * describe :清除缓存对话的框
 * Created by yhf on 2016/6/2.
 * PackageName com.mlz.mlzmall.ui.dialog.
 * ProjectName mlzmall_android.
 */
public class SettingDialog {
    private static View pw;
    private static TextView tv_exit;
    public static TextView tv_clear;
    public static PopupWindow pWindow;
    private static TextView tv;

    public static void clear(Context context) {
        //  退出对话框
        pw = LayoutInflater.from(context).inflate(R.layout.dialog_clean, null);
        tv_exit = (TextView) pw.findViewById(R.id.exit);
        tv_clear= (TextView) pw.findViewById(R.id.clear);
        pWindow = new PopupWindow(pw, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);//弹框显示大小
        pWindow.setFocusable(true);//设置点击
        pWindow.setBackgroundDrawable(new ColorDrawable(0x55000000));//设置背景为透明
        pWindow.setAnimationStyle(R.style.AnimationCenter);//设置对话框出现动画[注释后默认动画]
        pWindow.showAtLocation(pw, Gravity.CENTER, 0, 0);//设置对话框显示位置
   //    pWindow.showAsDropDown(tv);//设置对话框显示在某个控件上下左右位置
        tv_exit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                pWindow.dismiss();
            }
        });
    }
}
